﻿<%@ page import="account.AccountInfo" %>
<%@ page import="utils.TextUtils" %>
<%@ page import="com.opensymphony.xwork2.util.ValueStack" %>
<%@ page import="utils.Var" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
  <title></title>
  <link href="../../skin/default/global.css" rel="stylesheet" type="text/css"/>
  <link href="../../skin/default/layout.css" rel="stylesheet" type="text/css"/>
</head>

<body class="admin-content admin-panel-body">
<%
  ValueStack vs = (ValueStack) request.getAttribute("struts.valueStack");
  AccountInfo info = (AccountInfo) vs.findValue("info");
  boolean isAddNew = info.getAid() == 0;
%>
<!--<div class="icon" id="account"></div>-->

<%--<h1 class="title"><%=isAddNew ? "添加" : "管理"%>账户</h1>--%>

<form action="<%=isAddNew ? "addAccount" : "modiAccount"%>.action" method="post">
<input type="hidden" name="accountInfo.aid" value="<%=info.getAid()%>"/>

<div class="admin-contentpanel" style="width:500px;">
  <h2><span class="round"></span>用户信息</h2>

  <div class="overflow">
    <ul class="accountlist">
      <li>账　号：<label><input type="text" id="account_input" name="accountInfo.account" class="normal"
                            value="<%=TextUtils.html(info.getAccount())%>"/></label></li>
      <li>密　码：<label><input type="password" id="password_input" name="accountInfo.password" class="normal"/></label>
      </li>
      <!--<li>密码确认：<label><input type="password" id="password1_input" name="password1" class="normal"/></label></li>-->
      <li>用户名：<label><input type="text" id="username_input" name="accountInfo.aname"
                            value="<%=TextUtils.html(info.getAname())%>" class="normal"/></label></li>
      <li>部　门：<label><input type="text" id="group_input" name="accountInfo.group" class="normal"
                            value="<%=TextUtils.html(info.getGroup())%>"/></label></li>
      <li>级　别：<label><input type="text" id="level_input" name="accountInfo.level" class="normal"
                            value="<%=TextUtils.html(info.getLevel())%>"/></label></li>
    </ul>
    <br class="clear"/>
  </div>
</div>


<table cellpadding="0" style="width:500px;" cellspacing="0" class="admin-table">
  <thead>
    <tr>
      <th colspan="2" class="last"><span class="first"></span>权限设置</th>
    </tr>
  </thead>
  <tbody id="rightslist">
    <tr>
      <td width="15" class="first">
        <%
          boolean isControlIP = (info.getRights() & Var.RIGHT_CONTROL_IP) != 0;
        %>
        <input name="rights" type="checkbox" value="<%=Var.RIGHT_CONTROL_IP%>" <%= isControlIP ? "checked" : ""%>/>
      </td>
      <td class="last"><label for="a1">控制台IP设定</label></td>
    </tr>
    <tr class="even">
      <td width="15" class="first">
        <%
          boolean isControlExaminee = (info.getRights() & Var.RIGHT_CONTROL_EXAMINEE) != 0;
        %>
        <input name="rights" type="checkbox"
               value="<%=Var.RIGHT_CONTROL_EXAMINEE%>" <%= isControlExaminee ? "checked" : ""%>/>
      </td>
      <td class="last"><label for="a2">控制台考生安排</label></td>
    </tr>
    <tr>
      <td width="15" class="first">
        <%
          boolean isQuestion = (info.getRights() & Var.RIGHT_QUESTION) != 0;
        %>
        <input name="rights" type="checkbox" value="<%=Var.RIGHT_QUESTION%>" <%= isQuestion ? "checked" : ""%>/>
      </td>
      <td class="last"><label for="a3">题库管理</label></td>
    </tr>
    <tr>
      <td width="15" class="first">
        <%
          boolean isSetup = (info.getRights() & Var.RIGHT_SETUP) != 0;
        %>
        <input name="rights" type="checkbox" value="<%=Var.RIGHT_SETUP%>" <%= isSetup ? "checked" : ""%>/>
      </td>
      <td class="last"><label for="a3">分值设定</label></td>
    </tr>
    <tr>
      <td width="15" class="first">
        <%
          boolean isExamineeImport = (info.getRights() & Var.RIGHT_EXAMINEE_IMPORT) != 0;
        %>
        <input name="rights" type="checkbox"
               value="<%=Var.RIGHT_EXAMINEE_IMPORT%>" <%= isExamineeImport ? "checked" : ""%>/>
      </td>
      <td class="last"><label for="a3">考生导入</label></td>
    </tr>
    <tr>
      <td width="15" class="first">
        <%
          boolean isExamineeManage = (info.getRights() & Var.RIGHT_EXAMINEE_MANAGE) != 0;
        %>
        <input name="rights" type="checkbox"
               value="<%=Var.RIGHT_EXAMINEE_MANAGE%>" <%= isExamineeManage ? "checked" : ""%>/>
      </td>
      <td class="last"><label for="a3">考生增删</label></td>
    </tr>
    <tr>
      <td width="15" class="first">
        <%
          boolean isExamineeUpdate = (info.getRights() & Var.RIGHT_EXAMINEE_UPDATE) != 0;
        %>
        <input name="rights" type="checkbox"
               value="<%=Var.RIGHT_EXAMINEE_UPDATE%>" <%= isExamineeUpdate ? "checked" : ""%>/>
      </td>
      <td class="last"><label for="a3">考生修改</label></td>
    </tr>
    <tr>
      <td width="15" class="first">
        <%
          boolean isExam = (info.getRights() & Var.RIGHT_EXAM) != 0;
        %>
        <input name="rights" type="checkbox" value="<%=Var.RIGHT_EXAM%>" <%= isExam ? "checked" : ""%>/>
      </td>
      <td class="last"><label for="a3">考试查询</label></td>
    </tr>
    <tr>
      <td width="15" class="first">
        <%
          boolean isStatistic = (info.getRights() & Var.RIGHT_STATISTIC) != 0;
        %>
        <input name="rights" type="checkbox" value="<%=Var.RIGHT_STATISTIC%>" <%= isStatistic ? "checked" : ""%>/>
      </td>
      <td class="last"><label for="a3">考试统计</label></td>
    </tr>


  </tbody>
</table>

<div class="admin-tablenav" style="width:500px">
  <button type="submit" class="normal blue"><span></span>保存</button>
  <%
    if (!isAddNew) {
  %>
  <button type="submit" onClick="form.action='delAccount.action'" class="normal blue"><span></span>删除</button>
  <%
    }
  %>
</div>

</form>
<script src="../../common/jquery-1.3.2.min.js"></script>
<script src="../../common/fun.js"></script>
<script>
  var list = new KS.List("rightslist");
  $(function() {
    $("#account_input").focus()
  })
  function accountCheck() {

    if ($("#account_input").val() == "") {
      alert("请填写账号");
      $("#account_input").focus()
      return false;
    }
    else if ($("#username_input").val() == "") {
      alert("请填写用户名");
      $("#username_input").focus()
      return false;
    }
    else if ($("#password_input").val() == "") {
      alert("请填写密码");
      $("#password_input").focus()
      return false;
    }
    else if ($("#password1_input").val() == "") {
      alert("请填写密码");
      $("#password1_input").focus()
      return false;
    }
    else {
      return true;
    }
  }
</script>

</body>

</html>
